from bs4 import BeautifulSoup

if __name__ == '__main__':
    file = open(file="The Dormouse's story.html", mode="r", encoding="utf-8")
    html = file.read()
    file.close()

    # print(html)

    soup = BeautifulSoup(html, "html.parser")
    # 原样打印输入的字符串
    print(soup)
    # 输出美化好后的字符串
    print(soup.prettify())